package main;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import javax.swing.JButton;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.FlowLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.Component;
import javax.swing.Box;
import javax.swing.ButtonGroup;
import javax.swing.JLabel;
import javax.swing.JSeparator;
import java.awt.Color;
import javax.swing.border.BevelBorder;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.border.TitledBorder;

public class ManagerEtown extends JFrame {

    private JPanel            contentPane;
    private final ButtonGroup buttonGroup = new ButtonGroup();
    private JPanel            panel_1;

    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    ManagerEtown frame = new ManagerEtown();
                    frame.setVisible(true);

                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /**
     * Create the frame.
     */
    public ManagerEtown() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(100, 100, 844, 421);
        contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        setContentPane(contentPane);
        GridBagLayout gbl_contentPane = new GridBagLayout();
        gbl_contentPane.columnWidths = new int[] { 189, 0, 0 };
        gbl_contentPane.rowHeights = new int[] { 0, 0, 0 };
        gbl_contentPane.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
        gbl_contentPane.rowWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
        contentPane.setLayout(gbl_contentPane);

        Component verticalGlue = Box.createVerticalGlue();
        GridBagConstraints gbc_verticalGlue = new GridBagConstraints();
        gbc_verticalGlue.insets = new Insets(0, 0, 5, 0);
        gbc_verticalGlue.gridx = 1;
        gbc_verticalGlue.gridy = 0;
        contentPane.add(verticalGlue, gbc_verticalGlue);

        JPanel panel = new JPanel();
        GridBagConstraints gbc_panel = new GridBagConstraints();
        gbc_panel.insets = new Insets(0, 0, 0, 5);
        gbc_panel.fill = GridBagConstraints.BOTH;
        gbc_panel.gridx = 0;
        gbc_panel.gridy = 1;
        contentPane.add(panel, gbc_panel);
        GridBagLayout gbl_panel = new GridBagLayout();
        gbl_panel.columnWidths = new int[] { 136, 0 };
        gbl_panel.rowHeights = new int[] { 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
        gbl_panel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
        gbl_panel.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                Double.MIN_VALUE };
        panel.setLayout(gbl_panel);

        final JButton btnManagerAccount = new JButton("Manager Account");

        btnManagerAccount.setPreferredSize(new Dimension(170, 25));
        buttonGroup.add(btnManagerAccount);

        btnManagerAccount.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                accManager acc = new accManager();
                panel_1.removeAll();
                panel_1.add(acc);
                panel_1.updateUI();
                acc.loadtable();
                System.out.println("loading account success!");

            }
        });

       

        Component verticalStrut = Box.createVerticalStrut(20);
        GridBagConstraints gbc_verticalStrut = new GridBagConstraints();
        gbc_verticalStrut.insets = new Insets(0, 0, 5, 0);
        gbc_verticalStrut.gridx = 0;
        gbc_verticalStrut.gridy = 0;
        panel.add(verticalStrut, gbc_verticalStrut);
        GridBagConstraints gbc_btnManagerAccount = new GridBagConstraints();
        gbc_btnManagerAccount.weightx = 7.0;
        gbc_btnManagerAccount.insets = new Insets(0, 0, 5, 0);
        gbc_btnManagerAccount.gridx = 0;
        gbc_btnManagerAccount.gridy = 1;
        panel.add(btnManagerAccount, gbc_btnManagerAccount);

        JButton btnManagerCompany = new JButton("Manager Company");
        btnManagerCompany.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent e) {
        	    panel_1.removeAll();
        	    managercompany mancom = new managercompany();
        	    mancom.setVisible(true);
        	    panel_1.add(mancom);
                    panel_1.updateUI();
                    mancom.loadtable();
                    System.out.println("loading Companay success!");
        	}
        });
        btnManagerCompany.setPreferredSize(new Dimension(170, 25));
        buttonGroup.add(btnManagerCompany);
        

        Component verticalGlue_1 = Box.createVerticalGlue();
        GridBagConstraints gbc_verticalGlue_1 = new GridBagConstraints();
        gbc_verticalGlue_1.insets = new Insets(0, 0, 5, 0);
        gbc_verticalGlue_1.gridx = 0;
        gbc_verticalGlue_1.gridy = 2;
        panel.add(verticalGlue_1, gbc_verticalGlue_1);
        GridBagConstraints gbc_btnManagerCompany = new GridBagConstraints();
        gbc_btnManagerCompany.insets = new Insets(0, 0, 5, 0);
        gbc_btnManagerCompany.gridx = 0;
        gbc_btnManagerCompany.gridy = 3;
        panel.add(btnManagerCompany, gbc_btnManagerCompany);

        JButton btnManagerBlock = new JButton("Manager Block");
        btnManagerBlock.setPreferredSize(new Dimension(170, 25));
        buttonGroup.add(btnManagerBlock);
        btnManagerBlock.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {

            }
        });

        Component verticalGlue_2 = Box.createVerticalGlue();
        GridBagConstraints gbc_verticalGlue_2 = new GridBagConstraints();
        gbc_verticalGlue_2.insets = new Insets(0, 0, 5, 0);
        gbc_verticalGlue_2.gridx = 0;
        gbc_verticalGlue_2.gridy = 4;
        panel.add(verticalGlue_2, gbc_verticalGlue_2);
        GridBagConstraints gbc_btnManagerBlock = new GridBagConstraints();
        gbc_btnManagerBlock.insets = new Insets(0, 0, 5, 0);
        gbc_btnManagerBlock.gridx = 0;
        gbc_btnManagerBlock.gridy = 5;
        panel.add(btnManagerBlock, gbc_btnManagerBlock);

        JButton btnManagersetup = new JButton("Manager Setup Ofice ");
        btnManagersetup.setPreferredSize(new Dimension(170, 25));
        buttonGroup.add(btnManagersetup);
        btnManagersetup.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {

            }
        });

        Component verticalGlue_3 = Box.createVerticalGlue();
        GridBagConstraints gbc_verticalGlue_3 = new GridBagConstraints();
        gbc_verticalGlue_3.insets = new Insets(0, 0, 5, 0);
        gbc_verticalGlue_3.gridx = 0;
        gbc_verticalGlue_3.gridy = 6;
        panel.add(verticalGlue_3, gbc_verticalGlue_3);
        GridBagConstraints gbc_btnManager = new GridBagConstraints();
        gbc_btnManager.insets = new Insets(0, 0, 5, 0);
        gbc_btnManager.gridx = 0;
        gbc_btnManager.gridy = 7;
        panel.add(btnManagersetup, gbc_btnManager);

        JButton btnManagerSe = new JButton("Manager Service");
        btnManagerSe.setPreferredSize(new Dimension(170, 25));
        buttonGroup.add(btnManagerSe);
        btnManagerSe.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {

            }
        });

        Component verticalGlue_4 = Box.createVerticalGlue();
        GridBagConstraints gbc_verticalGlue_4 = new GridBagConstraints();
        gbc_verticalGlue_4.insets = new Insets(0, 0, 5, 0);
        gbc_verticalGlue_4.gridx = 0;
        gbc_verticalGlue_4.gridy = 8;
        panel.add(verticalGlue_4, gbc_verticalGlue_4);
        GridBagConstraints gbc_btnManagerSe = new GridBagConstraints();
        gbc_btnManagerSe.insets = new Insets(0, 0, 5, 0);
        gbc_btnManagerSe.gridx = 0;
        gbc_btnManagerSe.gridy = 9;
        panel.add(btnManagerSe, gbc_btnManagerSe);

        JButton btnManagerParking = new JButton("Manager Parking");
        btnManagerParking.setPreferredSize(new Dimension(170, 25));
        buttonGroup.add(btnManagerParking);
        btnManagerParking.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {

            }
        });

        Component verticalGlue_5 = Box.createVerticalGlue();
        GridBagConstraints gbc_verticalGlue_5 = new GridBagConstraints();
        gbc_verticalGlue_5.insets = new Insets(0, 0, 5, 0);
        gbc_verticalGlue_5.gridx = 0;
        gbc_verticalGlue_5.gridy = 10;
        panel.add(verticalGlue_5, gbc_verticalGlue_5);
        GridBagConstraints gbc_btnManagerParking = new GridBagConstraints();
        gbc_btnManagerParking.insets = new Insets(0, 0, 5, 0);
        gbc_btnManagerParking.gridx = 0;
        gbc_btnManagerParking.gridy = 11;
        panel.add(btnManagerParking, gbc_btnManagerParking);

        Component verticalGlue_6 = Box.createVerticalGlue();
        GridBagConstraints gbc_verticalGlue_6 = new GridBagConstraints();
        gbc_verticalGlue_6.insets = new Insets(0, 0, 5, 0);
        gbc_verticalGlue_6.gridx = 0;
        gbc_verticalGlue_6.gridy = 12;
        panel.add(verticalGlue_6, gbc_verticalGlue_6);

        JButton btnExit = new JButton("Exit");
        btnExit.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                System.exit(0);
            }
        });
        GridBagConstraints gbc_btnExit = new GridBagConstraints();
        gbc_btnExit.gridx = 0;
        gbc_btnExit.gridy = 13;
        panel.add(btnExit, gbc_btnExit);

        panel_1 = new JPanel();
        panel_1.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 0), 1, true), "", TitledBorder.LEADING,
                TitledBorder.TOP, null, null));
        GridBagConstraints gbc_panel_1 = new GridBagConstraints();
        gbc_panel_1.fill = GridBagConstraints.BOTH;
        gbc_panel_1.gridx = 1;
        gbc_panel_1.gridy = 1;
        contentPane.add(panel_1, gbc_panel_1);
        panel_1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

    }

    
    
   
}
